﻿package mortal.common.net
{
    import com.gengine.core.call.*;
    import flash.utils.*;

    public class CallLater extends Object
    {
        private static var _call:Caller = new Caller();
        private static var _isCall:Boolean = false;
        private static var CallType:String = "CallLater";
        private static var _closureMap:Dictionary = new Dictionary();

        public function CallLater()
        {
            return;
        }// end function

        public static function setCallLater(param1:Function, param2:Number, ... args) : int
        {
            return setTimeout(param1, param2 * 1000, args);
        }// end function

        public static function removeCallLater(param1:int) : void
        {
            clearTimeout(param1);
            return;
        }// end function

        public static function addCallBack(param1:Function) : void
        {
            setTimeout(param1, 50);
            return;
        }// end function

        private static function callBack() : void
        {
            _call.call(CallType);
            _isCall = false;
            _call.removeCallByType(CallType);
            _closureMap = new Dictionary();
            return;
        }// end function

    }
}
